import com.noppanit.library.interfaces.LibrarianInterfaceimport com.noppanit.library.implement.*
import com.noppanit.library.interfaces.*

class IndexController {

    def index = {     		
    		def directory = params.directory_name    		def description = params.description    		    		if( !directory.is("") && directory != null)    		{
    			LibrarianInterface library = new Librarian(new File('lucene-index'), new File(directory));
    			library.indexDirectory(description);    		}
    }        def indexFile = {    		def filename = params.myFile    		def description = params.description    		if( !filename.is("") && filename != null  )    		{    			LibrarianInterface library = new Librarian(new File('lucene-index'))    			library.indexFile(new File(filename),description)    		}    		redirect(view:index)    }
}
